<!DOCTYPE HTML>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
	<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
	<title>textPage</title>
	<style>
		* {
			padding: 0;
			margin: 0;
		}

		html,
		body {
			background: #FFF;
		}

		.clickbtn {
			width: 1;
			margin: 5px 10px;
			line-height: 45px;
			border: 1px #ccc dashed;
			text-align: center;
		}

		input {
			width: 100%;
			height: 40px;
		}
	</style>
</head>

<body>
	<header id="header"></header>
	<div tapmode onclick="api.closeWin();" style="line-height: 40px;"> 《返回</div>
	<div class="clickbtn" tapmode onclick="moduleClick('requestPermissionIfNecessary')">请求权限先</div>
	<div class="clickbtn" tapmode onclick="moduleClick('getVersions')">获取SDK版本</div>
	<div class="clickbtn" tapmode onclick="moduleClick('init')">初始化</div>
	<div class="clickbtn" tapmode onclick="moduleClick('showSplashAd')">打开开屏广告</div>
	<div class="clickbtn" tapmode onclick="moduleClick('loadRewardVideoAd_h')">加载横版激励视频广告</div>
	<div class="clickbtn" tapmode onclick="moduleClick('loadRewardVideoAd_v')">加载竖版激励视频广告</div>
	<div class="clickbtn" tapmode onclick="moduleClick('showRewardVideoAd')">展示激励视频广告</div>
	<div class="clickbtn" tapmode onclick="moduleClick('showBannerAd')">打开banner广告</div>
	<div class="clickbtn" tapmode onclick="moduleClick('showInteractionAd')">打开插屏广告</div>
	<div class="clickbtn" tapmode onclick="moduleClick('loadFullScreenVideoAd_h')">加载横版全屏视频广告</div>
	<div class="clickbtn" tapmode onclick="moduleClick('loadFullScreenVideoAd_v')">加载竖版全屏视频广告</div>
	<div class="clickbtn" tapmode onclick="moduleClick('showFullScreenVideoAd')">展示全屏视频广告</div>
</body>
<script type="text/javascript" src="../js/api.js"></script>
	<script type="text/javascript" src="../j/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
	var zyPangolinAd = null;
	apiready = function() {
		urls();
		_init_ad();
if(adName){
	zyPangolinAd = api.require(adName);
}

		var header = document.getElementById('header');
		header.style.paddingTop = api.safeArea.top + 'px';
 
		api.removeLaunchView();
	}

	function moduleClick(_type) {
		switch (_type) {
			case "getVersions":
				zyPangolinAd.getVersions(function(ret) {
					alert("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "requestPermissionIfNecessary":
				zyPangolinAd.requestPermissionIfNecessary();
				break;
			case "init":
				var param = {
					appId: "5043672",
					appName: "趣味短视频",
				};
				zyPangolinAd.init(param, function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "showSplashAd":
				var param = {
					setCodeId: "887289813", //代码位
					rect: { //开屏位置 默认0即为全屏 也可自定义
						x: 0,
						y: 0,
						w: 0,
						h: 0
					},
					fixedOn: "",
					fixed: true
				};
				zyPangolinAd.showSplashAd(param, function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "loadRewardVideoAd_h":
				var param = {
					setCodeId: "943671735", //代码位
					setOrientation: 2, //必填参数，期望视频的播放方向：1竖  2横
					setUserID: "user123", //用户id,必传参数
					setRewardName: "金币", //奖励的名称
					setRewardAmount: 3, //奖励的数量
					setMediaExtra: "", //附加参数，可选

				};
				zyPangolinAd.loadRewardVideoAd(param, function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "loadRewardVideoAd_v":
				var param = {
					setCodeId: "943671735",
					setOrientation: 1,
				};
				zyPangolinAd.loadRewardVideoAd(param, function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "showRewardVideoAd":
				zyPangolinAd.showRewardVideoAd(function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "showBannerAd":
				var param = {
					setCodeId: "940813564", //代码位
					rect: { //显示位置
						x: 30,
						y: 100,
						w: api.winWidth - 60,
						h: 180
					},
					fixedOn: "",
					fixed: true
				};
				zyPangolinAd.showBannerAd(param, function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "showInteractionAd":
				var param = {
					setCodeId: "943671733", //代码位
					w: 200, //根据穿山甲定义的比例 设置这里的宽高比
					h: 300,
				};
				zyPangolinAd.showInteractionAd(param, function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "loadFullScreenVideoAd_h":
				var param = {
					setCodeId: "944213571", //代码位
					setOrientation: 2, //必填参数，期望视频的播放方向：1竖  2横
				};
				zyPangolinAd.loadFullScreenVideoAd(param, function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "loadFullScreenVideoAd_v":
				var param = {
					setCodeId: "944213570",
					setOrientation: 1,
				};
				zyPangolinAd.loadFullScreenVideoAd(param, function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
			case "showFullScreenVideoAd":
				zyPangolinAd.showFullScreenVideoAd(function(ret) {
					console.log("zyPangolinAd：" + JSON.stringify(ret));
				});
				break;
		}
	}
</script>

</html>
